home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: delta / whiteline CD Series - delta.iso / tex / style / misc / lcaption.sty < prev    next >
Text File  |  1995-11-25  |  2KB  |  51 lines

  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. % lcaption.sty  1.0
  3. %
  4. % Provides smart formatting of long captions. The captions are 
  5. % formatted like:
  6. %            Figure 1: This is a
  7. %                  long text.
  8. %
  9. %                       <-----\CapSize----->
  10. %
  11. % If \CapSize is set to ZERO, it will fit the caption to \hsize
  12. % (the width of the surrounding text)
  13. %
  14. % The syntax is \lcaption[short]{long} just like LaTeX's caption command.
  15. % the [short] argument may be omitted.
  16. %
  17. % The command \smartcap will make \caption act like \lcaption. It
  18. % should be used only once.
  19. %
  20. % \CapSize defaults to ZERO, and may be set by a command like:
  21. %
  22. %     \CapSize=5in
  23. %
  24. % Based on original by Lars P. Fischer <fischer@iesd.auc.dk>
  25. % Parts of the code is taken from latex.tex (c) by Leslie Lamport
  26. % Put together by Kresten Krab Thorup <Krab@iesd.auc.dk> january 1991
  27. % You may not redistribute modified versions of this code, unless
  28. % you name it to something else than lcaption.sty
  29. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  30. \typeout{Style Option `lcaption' r1.0 <01/06/91> (KKT)}
  31.  
  32. \newdimen\CapSize\CapSize\z@
  33.  
  34. \long\def\@lmakecaption#1#2{
  35.  \vskip 10pt 
  36.  \setbox\@tempboxa\hbox{#1:\ }
  37.  \@tempdima\hsize\advance\@tempdima-\wd\@tempboxa
  38.  \ifdim\CapSize=\z@\else
  39.    \ifdim\@tempdima>\CapSize \@tempdima\CapSize\fi\fi
  40.  \setbox\@tempboxa\hbox{#1: #2}
  41.  \ifdim\wd\@tempboxa<\hsize\hfil #1: #2\hfil\par\else
  42.  \hbox to\hsize{\hfil #1: \parbox[t]\@tempdima{#2}\hfil} 
  43.  \fi}
  44.  
  45. \def\lcaption{\let\@makecaption\@lmakecaption\caption}
  46.  
  47. \def\smartcap{\def\caption{\let\@makecaption\@lmakecaption
  48. \refstepcounter\@captype \@dblarg{\@caption\@captype}}}
  49.  
  50.  
  51.